<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{=T.accepted_language or 'br'}}">
<head>
    <title>{{=response.title or request.application}}</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
{{response.files.append(URL(r=request,c='static',f='js/ckeditor/ckeditor.js'))}}
{{response.files.append(URL(r=request,c='static',f='jquery.dataTables.min.js'))}}
{{response.files.append(URL(r=request,c='static',f='demo_table.css'))}}
</head>
{{if vimp!='imp':}}
       {{extend 'layout.html'}}
{{else:}}   
        <table><tr><td><h1>Mestre - Mecanismo Sinérgico de Treinamento</h1></td></tr></table>
{{pass}}   
<h1>Resultado de notas</h1>
{{if resposta:}}
   <table>
     <tr><td>{{=button('Nova Pesquisa','graf_bar')}}</td></tr>     
   </table>
{{else:}}   
  <table>
      <tr><td>{{=pergunta}}</td></tr>
      <tr><td>{{=button('Nova Pesquisa','graf_bar')}}&nbsp;{{=button('Vista para Impressão','graf_bar/imp')}}</td></tr>  
  </table>  
{{pass}}    
<br>
{{if notar:}}
  <table border=1><tr><td><seq></td><td>Professor</td><td>Data</td><td>Prova</td><td>Turma</td><td>Aluno</td><td>Nota</td></tr>
  {{for item, reg in enumerate(notar):}}
    <tr><td>{{=item+1}})</td>
        <td>{{=reg['professor']}}</td>
        <td>{{=reg['data']}}</td>
        <td>{{=reg['prova']}}</td>
        <td>{{=reg['turma']}}</td>
        <td>{{=reg['nome']}}</td>
        <td>{{=reg['nota']}}</td></tr>
  {{pass}}
{{pass}}
</table>
<br>
{{if notar:}}
 <table border=1><tr><td><seq></td><td>Aluno</td><td>Tipo Avaliação</td><td>Taxonomia</td><td>Nota</td></tr>
 {{if testebanco:}}
   {{for item, reg in enumerate(testebanco):}}
    <tr><td>{{=item+1}})</td>
        <td>{{=reg[0]+ ' ' + reg[1]}}</td>
        <td>{{=reg[2]}}</td>
        <td>{{=reg[3]}}</td>
        <td>{{=reg[4]}}</td></tr>
   {{pass}}
 {{pass}}  
 <br>
 </table>
 <h1>Notas de todos alunos de todoas as turmas</h1>
 <BR>
 <BR>
 <script type="text/javascript" src="/{{=request.application}}/static/js/protovis-3.1/protovis-r3.1.js">
 </script>
 <script type="text/javascript">

var alunos_notas;
alunos_notas={{=resposta}};

var grafico = new pv.Panel()
    .width(600)
    .height(500)
    .right(60)
    .bottom(20);

grafico.add(pv.Bar)
     .data(alunos_notas)
     .top(function(d) (this.index * 40))
     .height(25)
     .left(300)
     .width(function(d) d.start*30)
  .add(pv.Label)
      .left(5)
      .top(function(d) (this.index * 40))
      .textBaseline("top")
      .textMargin(6)
      .font("bold italic 16px serif")
      .text(function(d) d.name)
 
  .add(pv.Label)
      .height(5)
      .left(function(d) d.start * 30 + 300)  
      .textMargin(6)  
      .font("bold italic 16px serif")
      .text(function(d) d.start);

var linhas = grafico.add(pv.Rule)
    .data(pv.range(0, 10, .1))
    .left(function(d) d * 30 + 300)
    .strokeStyle(function(d) d ? "white" : "black")
    
    
var label_notas = grafico.add(pv.Label)
    .left(function() grafico.width()+80)
    .top(function() grafico.top()+ grafico.height()/2)
    .textAlign("center")
    .textBaseline("top")
    .textStyle("black");

grafico.render();

</script>
{{pass}}
